//
//  ViewController.m
//  IOS-5day-01
//
//  Created by RIOS on 2018/4/12.
//  Copyright © 2018年 RIOS. All rights reserved.
//

#import "ViewController.h"

@interface ViewController () <UIScrollViewDelegate>
@property (weak, nonatomic) IBOutlet UIScrollView *vScrollView;
@property (weak, nonatomic) IBOutlet UIImageView *vImage;
- (IBAction)moveClick:(id)sender;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.vScrollView.contentSize = self.vImage.frame.size;
    self.vScrollView.contentInset = UIEdgeInsetsMake(20, 20, 20, 20);
    self.vScrollView.showsVerticalScrollIndicator = false;
    self.vScrollView.showsHorizontalScrollIndicator = false;
    self.vScrollView.delegate = self;
    self.vScrollView.maximumZoomScale = 4;
    self.vScrollView.minimumZoomScale = 0.1;
}


-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{
    return self.vImage;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)moveClick:(id)sender {
    CGPoint p = self.vScrollView.contentOffset;
    p.x +=150;
    p.y += 150;
   
    [self.vScrollView setContentOffset:p animated:true];
    
}
@end
